package top.lyc829.zzl_android.logic.database.dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;

import java.util.List;

import top.lyc829.zzl_android.logic.bean.NoticeCommentBean;
import top.lyc829.zzl_android.logic.bean.NoticeSystemBean;

@Dao
public interface NoticeCommentDao {

    @Insert
    void insertNoticeComments(NoticeCommentBean...commentBeans);

    @Delete
    void deleteNoticeComments(NoticeCommentBean...commentBeans);

    @Query("DELETE FROM notice_comment")
    void deleteAllNoticeComments();

    @Query("SELECT * FROM notice_comment WHERE ID = :id LIMIT 1")
    NoticeCommentBean findItemById(Integer id);

    @Query("SELECT * FROM notice_comment WHERE NOTICETYPE = :noticeType ORDER BY ID DESC")
    List<NoticeCommentBean> getNoticeCommentsByNoticeType(Integer noticeType);

    @Query("SELECT * FROM notice_comment WHERE NOTICETYPE = :noticeType AND CURRENTLOGINUSERID = :userId ORDER BY ID DESC")
    List<NoticeCommentBean> getNoticeCommentsByNoticeTypeAndUserId(Integer noticeType, Integer userId);

}
